package org.adorsys.aderp.orga.domain;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.entity.RooJpaEntity;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaEntity
public class OrgaPerson {

    @NotNull
    @Column(name = "personNumberBk", unique = true)
    private String personNumber;

    private String busiRegistNumber;

    private String taxIdNumber;

    private String vatNumber;

    private String firstName;

    private String middleName;

    private String lastName;

    private String shortName;

    @NotNull
    @ManyToOne
    private Gender gender;

    private String phoneNumberOffice;

    private String phoneNumberPrivate;

    private String emailContact;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "dd-MM-yyyy hh:mm:ss")
    private Date birthDate;

    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "dd-MM-yyyy hh:mm:ss")
    private Date termination;

    @ManyToOne
    private MaritalStatus maritalStatus;

    private BigDecimal numberOfChildren;

    private String personLanguages;

    @ManyToMany
    private Set<EduDegree> schoolDegrees = new HashSet<EduDegree>();

    @ManyToMany
    private Set<AccTitle> accTitles = new HashSet<AccTitle>();

    @ManyToMany
    private Set<HonorTitle> honorTitles = new HashSet<HonorTitle>();

    @ManyToMany
    private Set<Country> nationalities = new HashSet<Country>();

    private String religion;

    private String bloodGroup;

    private String rhesus;

    @ManyToMany
    private Set<DisabilityType> disabilities = new HashSet<DisabilityType>();

    private String auditionNote;

    private String visionNote;

    @ManyToMany
    private Set<OrgaPersonRole> personRoles = new HashSet<OrgaPersonRole>();

    @ManyToMany
    private Set<OrgaPersonForm> personForms = new HashSet<OrgaPersonForm>();
    
    private String recordOwner;
    
    public String getBirthDateString(){
    	if(birthDate!=null) return "" + birthDate.getTime();
    	return null;
    }
    
}
